package com.zy.openchat.core.model.circle;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

public class BlogRuleInfo implements Parcelable {

    public static final int RULE_OF_ALL = 1;
    public static final int RULE_OF_SPECIFIC_USER = 2;
    public static final int RULE_OF_SPECIFIC_DATE = 3;
    public static final int RULE_OF_SPECIFIC_NUMBER = 4;
    //1 - 允许所有
    //2 - 受限的用户
    //3 - 设定的日期
    //4 - 设定的数量
    public int rule;
    public int days;
    public List<Long> users;
    public int counts;


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.rule);
        dest.writeInt(this.days);
        dest.writeList(this.users);
        dest.writeInt(this.counts);
    }

    public void readFromParcel(Parcel source) {
        this.rule = source.readInt();
        this.days = source.readInt();
        this.users = new ArrayList<Long>();
        source.readList(this.users, Long.class.getClassLoader());
        this.counts = source.readInt();
    }

    public BlogRuleInfo() {
    }

    protected BlogRuleInfo(Parcel in) {
        this.rule = in.readInt();
        this.days = in.readInt();
        this.users = new ArrayList<Long>();
        in.readList(this.users, Long.class.getClassLoader());
        this.counts = in.readInt();
    }

    public static final Parcelable.Creator<BlogRuleInfo> CREATOR = new Parcelable.Creator<BlogRuleInfo>() {
        @Override
        public BlogRuleInfo createFromParcel(Parcel source) {
            return new BlogRuleInfo(source);
        }

        @Override
        public BlogRuleInfo[] newArray(int size) {
            return new BlogRuleInfo[size];
        }
    };
}
